/*
 * @Author: sunzhijun 
 * @Date: 2019-04-18 14:41:22 
 * @Last Modified by: sunzhijun
 * @Last Modified time: 2019-11-22 14:49:59
 */
import React from 'react';
import './index.less';
import {render, connect} from 'src/hrpub/common/frame';
import Pagination from 'src/hrpub/common/components/Pagination';

const TableList = render({
    // actions: {
        // headerAct: HeaderAction
        // cardAct: CardAction,
        // tableAct: TableAction,
        // btnAct: ButtonAction
    // }
})(({props, state}) => {
    const { editTable, search, action, main } = props;
    let { tableHeight } = main;
    const { NCCreateSearch } = search;
    main.pageInfo.pageIndex = parseInt(main.pageInfo.pageIndex);
    let setHeight = tableHeight || action.tableAct.getTableHeight();
    return (
        <div className="main-table">
            <div id="tableListData">
                {
                    editTable.createEditTable('poi_list', {
                        showIndex: true,
                        showCheck: true,
                        onRowClick: action.tableAct.getTableRowData,
                        onRowDoubleClick: action.tableAct.toCardForm,
                        height: setHeight,
                        cancelCustomRightMenu: true,
                        onSelected: action.tableAct.onSelected,
                        // adaptionHeight:true
                    })
                }
            </div>
            <div style={{display: "none"}}>
                {
                    NCCreateSearch('query', {
                        clickSearchBtn: action.headerAct.searchData,
                        onlyShowAdvArea: false,
                        showAdvSearchPlanBtn: true,
                        onlyShowSuperBtn: true
                    })
                }
            </div>
            {
                main.isVisiblePagination ?
                <div className="pagination">
                    <Pagination
                        current = {main.pageInfo.pageIndex}
                        // hideOnSinglePage = {true}
                        showSizeChanger = {true}
                        // defaultCurrent = {1}
                        pageSize = {main.pageInfo.pageSize}
                        showQuickJumper = {true}
                        // hideOnSinglePage = { false }
                        total = {main.pageInfo.total}
                        onChange= {action.tableAct.changePagination}
                        onShowSizeChange = {action.tableAct.pageSizeSelect}
                    />
                </div> : null
            }
        </div>
    );
});


export default TableList;